package com.groupname.dangerousdelves;

import android.media.SoundPool;

// -------------------------------------------------------------------------
/**
 *  Write a one-sentence summary of your class here.
 *  Follow it with additional details about its purpose, what abstraction
 *  it represents, and how to use it.
 *
 *  @author Chris Fieldman (Chrisf90)
 *  @version 2012.11.18
 */
public class AndroidSound
    implements Sound
{
    //~-------------------------------------------------------------------------
    // Member Variables
    private int soundId;
    SoundPool soundPool;

    //~-------------------------------------------------------------------------
    // Constructors
    /**
     * Create a new AndroidSound object.
     * @param soundPool
     * @param soundId
     */
    public AndroidSound(SoundPool soundPool, int soundId)
    {
        this.soundPool = soundPool;
        this.soundId = soundId;
    }

    //~-------------------------------------------------------------------------
    // Methods
    public void play(float volume)
    {
        this.soundPool.play(soundId, volume, volume, 0, 0, 1);
    }

    public void dispose()
    {
        soundPool.unload(soundId);
    }

}
